package com.bnz.service.impl;

import com.bnz.mapper.ClassesMapper;
import com.bnz.pojo.Classes;
import com.bnz.service.ClassesServce;
import com.bnz.util.DbUtils;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;
import java.util.List;

public class ClassesServiceImpl implements ClassesServce {

    @Override
    public List<Classes> findAll() throws IOException {
        try (SqlSession sqlSession = DbUtils.getSqlSession()) {
            ClassesMapper mapper = sqlSession.getMapper(ClassesMapper.class);
            List<Classes> classes = mapper.findAll();
            if (classes != null) {
                System.out.println("查询成功");
            }
            return classes;
        }
    }
}
